<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>自定义指令</title> 
    </head>
    <body>
        <div id = "app">
            <div v-test:msg.a.b="message"></div>
        </div>
        <script src = "https://unpkg.com/vue/dist/vue.min.js"></script>
        <script>
            Vue.directive('test',{
                bind: function(el,binding,vnode){
                    var keys = [];
                    for(var i in vnode){
                        keys.push(i);
                    }
                    el.innerHTML = 
                        'name:'             +binding.name+'<br>'+
                        'value:'            +binding.value+'<br>'+
                        'expression:'        +binding.expression+'<br>'+
                        'argument:'          +binding.argument+'<br>'+
                        'modifiers:'         +JSON.stringify(binding.modifiers)+'<br>'+
                        'vnode keys:'        +keys.join(', ')
                }
            });
            var app = new Vue({
                el:'#app',
                data:{
                    message:'some text'
                }
            })
        </script>
    </body>
</html>